<template>
  <div class="hello">
    <h1>{{ counter.count }}</h1>
    <button @click="plus(1)">plus</button>
    <button @click="plusAsync(2)">plus-async</button>
  </div>
</template>

<script setup>
import { useCounterStore } from '@/pinia-store/index.js';

const counter = useCounterStore();
// console.log(counter);
//Proxy {$id: 'counter', $onAction: ƒ, $patch: ƒ, $reset: ƒ, $subscribe: ƒ, …}

const plus = (num) => {
  counter.$patch({
    count: (counter.count += num)
  });
};

const plusAsync = (num) => {
  counter.plusAsync(num);
};
</script>
